package com.yupi.springbootinit.bizmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Slf4j
public class BiMqProducer {
    @Resource
    private RabbitTemplate rabbitTemplate;//通过在application中的配置来自动注入客户端


    /**
     * @param exchange 绑定交换机
     * @param routingKey  绑定路由键
     * @param message   绑定发送消息
     */
    public void sendMessage(String exchange,String routingKey,String message){
        rabbitTemplate.convertAndSend(exchange,routingKey,message);
    }
}
